from rest_framework import permissions


class IsAdminPermission(permissions.BasePermission):
    message = '很抱歉，您需要具备管理员权限才能够进行此操作'

    def has_permission(self, request, view):
        if request.user.is_admin:
            return True
        return False
